package com.oracle.application.controller;

import com.oracle.application.feign.PhoneFeign;
import com.oracle.application.feign.vo.Phone;
import com.oracle.application.feign.vo.PhoneVo;
import com.oracle.application.vo.R;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @Author 张家城
 * @Date 2021-07-06 下午 3:06
 * @Version 1.0
 */
@RestController
@RequestMapping("/phone")
public class PhoneController {
    @Autowired
    private PhoneFeign phoneFeign;

    @GetMapping("/getPhoneAll")
    public List<Phone> getPhoneAll(){
        return this.phoneFeign.list();
    }

    @PostMapping("/addPhone")
    public R<Phone> addMember(@RequestBody Phone phone){
        return this.phoneFeign.add(phone);
    }
    @PostMapping("/Updatephone")
    public R<Phone> update(@RequestBody Phone phone){
        return this.phoneFeign.update(phone);
    }


    @PostMapping("/Id")
    public R<Phone> getPhoneId(@RequestBody Integer id){
       return    this.phoneFeign.getPhoneId(id);
    }


    @PostMapping("/phoneId")
    public R<Phone> updatePhoneId(@RequestBody Integer id){
      return  this.phoneFeign.updatePhoneId(id);
    }

    @GetMapping("/page")
    public R page(Integer current, Integer pageSize, PhoneVo phoneVo){
        return this.phoneFeign.page(current,pageSize,phoneVo);
    }

}
